package ch.myDungeons.gameObjects;


/**
 * A weapon that grants its wielder higher damage output
 * @author Grii
 *
 */
public class Weapon extends Item {
	private static final long serialVersionUID = -7341768912539072100L;

	/** Attack damage bonus */
	public int attackDamageBonus = 0;
	
	/** Attack damage dice */
	public int attackDamageDice = 0;
	
	public Weapon (String itemName, int attackDamageBonus, int attackDamageDice) {
		super(itemName);
		this.attackDamageBonus = attackDamageBonus;
		this.attackDamageDice = attackDamageDice;
	}

	public int getAttackDamage() {
		int dmg = attackDamageDice * ((int)(Math.random()*6) + 1) + attackDamageBonus;
		return dmg;
	}
	
	/** Returns a copy of the item */
	public Weapon getCopy() {
		Weapon copy = new Weapon(name, attackDamageBonus, attackDamageDice);
		return copy;
	}
	
	/** returns name, count, itemtype, damageBonus, damageDice. split at ITEMINFO */
	public String getSave() {
		String result = super.getSave() + "<ITEMINFO>weapon<ITEMINFO>" + attackDamageBonus + "<ITEMINFO>" + attackDamageDice;
		return result;
	}
}
